import React, {useEffect, useState} from "react";
import {useLocation, useNavigate} from "react-router-dom";
import {
    Form,
    Input,
    Button,
} from 'antd-mobile'

const DeviceAdd = () => {
    const location = useLocation()
    const navigate = useNavigate()

    const temp = location.pathname.split('/')
    const typeId = Number(temp[temp.length - 1])

    return <Form
        layout='horizontal' mode='card'
        footer={
            <Button block type='submit' color='primary' size='large' onClick={() => {
                navigate('/')
            }}>
                提交
            </Button>
        }
    >
        <Form.Item name='name' label='设备名称'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='machineRoom' label='机房名称'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='district' label='所属区县'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='type' label='设备类型'>
            <Input placeholder='请输入'/>
        </Form.Item>
        {typeId === 1 && <Form.Item name='supplyMode' label='送风方式'>
            <Input placeholder='请输入'/>
        </Form.Item>}
        <Form.Item name='capacity' label='额定容量'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='productionTime' label='出厂日期'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='updatePerson' label='修改人'>
            <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item name='updateTime' label='修改时间'>
            <Input placeholder='请输入'/>
        </Form.Item>
    </Form>
    // }

}

export default DeviceAdd
